#!/usr/bin/env bash

# ===================== Basic variable settings =====================

if test -e /usr/local/bin/f8x
then
    sleep 0.001
    # f8x -update
else
    curl -o f8x https://f8x.io/ && mv --force f8x /usr/local/bin/f8x && chmod +x /usr/local/bin/f8x && echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;32m[INFOR]\033[0m - \033[1;32mInstalled f8x tools\033[0m" || echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;31m[ERROR]\033[0m - \033[1;31mf8x installation failed\n\033[0m"
fi

. /usr/local/bin/f8x > /dev/null 2>&1

F8x_ctf_Version="0.1.2 Dev(2024/01/03)"

# ===================== Software version variable setting =====================

bkcrack_Ver="v1.7.0"
bkcrack_bin="bkcrack-1.7.0-Linux.tar.gz"
bkcrack_dir="bkcrack-1.7.0-Linux"
upx_Ver="v3.96"
upx_bin_amd64="upx-3.96-amd64_linux.tar.xz"
upx_dir_amd64="upx-3.96-amd64_linux"
upx_bin_arm64="upx-3.96-arm64_linux.tar.xz"
upx_dir_arm64="upx-3.96-arm64_linux"

Main
Pentest_Base_Install > /dev/null 2>&1

# ===================== CTF WEB Tool =====================

CTF_WEB_py3_module_install(){

    Install_Switch4 "itsdangerous"

}

CTF_GitHack_install(){

    name="GitHack"
    dir="$P_Dir/GitHack"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/lijiejie/GitHack.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_Git_Extract_install(){

    name="GitHack"
    dir="$P_Dir/Git_Extract"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/gakki429/Git_Extract.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_dumpall_install(){

    name="dumpall"
    which dumpall > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch4 "dumpall"
    fi

}

CTF_flask-session-cookie-manager_install(){

    name="flask-session-cookie-manager"
    dir="$P_Dir/flask-session-cookie-manager"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/noraj/flask-session-cookie-manager.git $dir > /dev/null 2>&1
        cd $dir && python3 setup.py install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

Pentest_redis-ssrf_Install(){

    name="redis-ssrf"
    dir="$P_Dir/redis-ssrf"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/xmsec/redis-ssrf.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== CTF MISC Tool =====================

CTF_Misc_install(){

    Install_Switch "strace"
    Install_Switch "unrar"
    Install_Switch "python3-tk"
    Install_Switch "android-tools-adb"
    Install_Switch "foremost"
    Install_Switch "rarcrack"

}

CTF_Misc_py3_module_install(){

    Install_Switch4 "base58"
    Install_Switch4 "requests"
    Install_Switch4 "zlib" > /dev/null 2>&1
    Install_Switch4 "struct" > /dev/null 2>&1
    Install_Switch4 "libnum"
    Install_Switch4 "Plaso"
    Install_Switch4 "matplotlib"
    Install_Switch4 "tqdm"
    python3 -m pip install --upgrade Pillow > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name"

}

CTF_Misc_py2_module_install(){

    Install_Switch3 "pybase62"
    Install_Switch3 "base92"
    python2 -m pip install Pillow > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name"

}

CTF_stegoveritas_install(){

    name="stegoveritas"
    which stegoveritas > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        pip3 install stegoveritas 1> /dev/null 2>> /tmp/f8x_error.log
        stegoveritas_install_deps > /dev/null 2>&1
        which stegoveritas > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_ImageMagick_install(){

    name="ImageMagick"
    which convert > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "graphicsmagick-imagemagick-compat" || Echo_ERROR2
        Install_Switch "imagemagick" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_morse2ascii_install(){

    name="morse2ascii"
    which morse2ascii > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "morse2ascii" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_exiftool_install(){

    name="exiftool"
    which exiftool > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "exiftool" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_steghide_install(){

    name="steghide"
    which steghide > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "steghide" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_pdfinfo_install(){

    name="pdfinfo"
    which pdfinfo > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "poppler-utils" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
    fi

}

CTF_zbarimg_install(){

    name="zbarimg"
    which zbarimg > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*)
                Install_Switch "zbar" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "zbar-tools" && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
                ;;
            *) ;;
        esac
    fi

}

CTF_outguess_install(){

    name="outguess"
    which outguess > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/outguess && cd /tmp/outguess
        $Proxy_OK git clone --depth 1 https://github.com/crorvick/outguess > /dev/null 2>&1 || Echo_ERROR2
        cd outguess
        ./configure > /dev/null 2>&1 && make > /dev/null 2>&1 && make install > /dev/null 2>&1
        which outguess > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
        rm -rf /tmp/outguess
    fi

}

CTF_bkcrack_install(){

    name="bkcrack"
    which bkcrack > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/bkcrack && cd /tmp/bkcrack
        $Proxy_OK wget https://github.com/kimci86/bkcrack/releases/download/$bkcrack_Ver/$bkcrack_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $bkcrack_bin > /dev/null 2>&1
        cp $bkcrack_dir/bkcrack /usr/sbin/bkcrack
        which bkcrack > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
        rm -rf /tmp/bkcrack
    fi

}

CTF_zsteg_install(){

    name="zsteg"
    which zsteg > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        $Proxy_OK gem install zsteg 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $name" || Echo_ERROR "Calling gem to install zsteg failed! Please run the -ruby option to install the Ruby environment"
    fi

}

CTF_F5-steganography_install(){

    name="F5-steganography"
    dir="$P_Dir/F5-steganography"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/matthewgao/F5-steganography.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_LSB-Steganography_install(){

    name="LSB-Steganography"
    dir="$P_Dir/LSB-Steganography"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone https://github.com/RobinDavid/LSB-Steganography.git > /dev/null 2>&1 || Echo_ERROR2
        cd LSB-Steganography && pip3 install -r requirements.txt > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_BlindWaterMark_install(){

    name="BlindWaterMark"
    dir="$P_Dir/BlindWaterMark"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else

        Install_Switch3 "opencv-python==4.2.0.32"
        cd $P_Dir && $Proxy_OK git clone https://github.com/chishaxie/BlindWaterMark.git > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && python2 -m pip install -r requirements.txt > /dev/null
        cd $dir && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_crc32_install(){

    name="crc32"
    dir="$P_Dir/crc32"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone https://github.com/theonlypwner/crc32.git > /dev/null 2>&1 || Echo_ERROR2
        cd crc32
        python3 crc32.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_cloacked-pixel_install(){

    name="cloacked-pixel"
    dir="$P_Dir/cloacked-pixel"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else

        Install_Switch3 "numpy"
        Install_Switch3 "matplotlib"

        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "python-tk"
                apt-get install -y python-backports.functools-lru-cache > /dev/null 2>&1
                ;;
            *) ;;
        esac

        cd $P_Dir && $Proxy_OK git clone https://github.com/livz/cloacked-pixel.git > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_stegosaurus_install(){

    name="stegosaurus"
    dir="$P_Dir/stegosaurus"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone https://github.com/AngelKitty/stegosaurus.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR2
    fi

}

# ===================== CTF CRYPTO Tool =====================

CTF_Crypto_install(){

    Install_Switch "python-gmpy2"
    Install_Switch "python3-gmpy2"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*)
            echo "" # 暂时不填
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch "libgmp-dev"
            Install_Switch "libmpfr-dev"
            Install_Switch "libmpc-dev"
            ;;
        *) ;;
    esac

}

CTF_Crypto_py3_module_install(){

    #name="ciphey"
    #python3 -m pip install --upgrade ciphey > /dev/null 2>&1 && Echo_INFOR "已安装 ciphey" || Echo_ERROR "尝试使用 --ignore-installed 安装"
    Install_Switch4 "xortool"
    Install_Switch4 "pycrypto"
    Install_Switch4 "primefac"
    Install_Switch4 "gmpy"
    Install_Switch4 "gmpy2"
    Install_Switch4 "rsa"
    Install_Switch4 "owiener"
    Install_Switch4 "factordb-python"
    Install_Switch4 "sympy"
    Install_Switch4 "Arithmetic"
    Install_Switch4 "secret"
    Install_Switch4 "gmssl"

}

CTF_Crypto_py2_module_install(){

    Install_Switch3 "libnum"
    Install_Switch3 "owiener"
    Install_Switch3 "primefac"

}

CTF_rsatool_install(){

    name="rsatool"
    dir="$P_Dir/rsatool"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/ius/rsatool.git > /dev/null 2>&1 || Echo_ERROR2
        cd rsatool && python3 rsatool.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_RsaCtfTool_install(){

    name="RsaCtfTool"
    dir="$P_Dir/RsaCtfTool"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        case $Linux_Version in
            *"Fedora"*)
                Install_Switch "gmp-devel"
                Install_Switch "mpfr-devel"
                Install_Switch "libmpc-devel"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "libgmp3-dev"
                ;;
            *) ;;
        esac

        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/Ganapati/RsaCtfTool.git > /dev/null 2>&1 || Echo_ERROR2
        cd RsaCtfTool
        pip3 install -r "requirements.txt" > /dev/null 2>&1
        pip3 install -r "optional-requirements.txt" > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

CTF_CTF-RSA-tool_install(){

    name="CTF-RSA-tool"
    dir="$P_Dir/CTF-RSA-tool"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/3summer/CTF-RSA-tool.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR2
    fi

}

CTF_rsa-wiener-attack_install(){

    name="rsa-wiener-attack"
    dir="$P_Dir/rsa-wiener-attack"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone https://github.com/pablocelayes/rsa-wiener-attack.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR2
    fi

}

CTF_basecrack_install(){

    name="basecrack"
    dir="$P_Dir/basecrack"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/mufeedvh/basecrack.git > /dev/null 2>&1 || Echo_ERROR2
        cd basecrack
        pip3 install -r "requirements.txt" > /dev/null 2>&1
        python3 basecrack.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== CTF IOT Tool =====================

CTF_IOT_install(){

    Install_Switch "btscanner"

}

CTF_firmware_mod_kit_Install(){

    name="firmware-mod-kit"
    dir="/opt/firmware-mod-kit/trunk"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else

        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*)
                Install_Switch3 "firmware-mod-kit"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch3 "firmware-mod-kit"
                ;;
            *) ;;
        esac

    fi

}

# ===================== CTF RE Tool =====================

CTF_RE_py3_module_install(){

    Install_Switch4 "uncompyle6"

}

CTF_RE_pyinstxtractor_install(){

    name="pyinstxtractor"
    dir="$P_Dir/pyinstxtractor"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone https://github.com/extremecoders-re/pyinstxtractor.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR2
    fi

}

CTF_RE_upx_install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            upx_bin=$upx_bin_amd64
            ;;
        *"linux-arm64"*)
            upx_bin=$upx_bin_arm64
            ;;
    esac

    name="upx"
    which upx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/upx && cd $_ && rm -f $upx_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/upx/upx/releases/download/$upx_Ver/$upx_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -xvJf $upx_bin > /dev/null 2>&1 && cd $upx_dir
        mv --force upx /usr/local/bin/upx && chmod +x /usr/local/bin/upx && rm -rf /tmp/upx > /dev/null 2>&1
        which upx > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $upx_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== CTF PWN Tool =====================

CTF_PWN_install(){

    Install_Switch "gdb"

    case $Linux_Version in
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch "libssl-dev"
            Install_Switch "libffi-dev"
            Install_Switch "build-essential"
            Install_Switch "gcc-multilib"
            Install_Switch "python-dev"
            Install_Switch "python3-dev"
            ;;
        *) ;;
    esac

}

CTF_PWN_py3_module_install(){

    pip3 install --upgrade pip > /dev/null 2>&1
    Install_Switch4 "setuptools"
    Install_Switch4 "capstone"
    Install_Switch4 "filebytes"
    Install_Switch4 "keystone-engine"
    Install_Switch4 "ropper"
    Install_Switch4 "pathlib2"
    Install_Switch4 "psutil"

}

CTF_PWN_py2_module_install(){

    python2 -m pip install --upgrade pip > /dev/null 2>&1
    Install_Switch3 "pathlib2"
    Install_Switch3 "psutil"

}

CTF_PWN_pwntools_install(){

    name="pwntools"
    Install_Switch3 "pwntools"
    Install_Switch4 "pwntools"

}

CTF_PWN_pwndbg_install(){

    name="pwndbg"
    dir="$P_Dir/pwndbg"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 https://github.com/pwndbg/pwndbg.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
        cd $dir && echo "source /pentest/pwndbg/gdbinit.py" > ~/.gdbinit
    fi

}

CTF_PWN_one_gadget_install(){

    name="one_gadget"
    gem install one_gadget > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || one_gadget_install2

}

one_gadget_install2(){

    Echo_ERROR "one_gadget installation failed, try to reinstall one_gadget"

    case $Linux_Version in
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            add-apt-repository ppa:brightbox/ruby-ng
            apt-get update
            apt-get purge --auto-remove ruby
            apt-get install -y ruby2.6 ruby2.6-dev
            gem install one_gadget
            ;;
        *) ;;
    esac

}

# -web

CTF_WEB_tools(){

    Rm_Lock
    echo -e "\033[1;33m\n>> Installing common py modules\n\033[0m"
    CTF_WEB_py3_module_install
    echo -e "\033[1;33m\n>> Installing Sqlmap\n\033[0m"
    Pentest_Sqlmap_Install
    echo -e "\033[1;33m\n>> Installing GitHack\n\033[0m"
    CTF_GitHack_install
    echo -e "\033[1;33m\n>> Installing Git_Extract\n\033[0m"
    CTF_Git_Extract_install
    echo -e "\033[1;33m\n>> Installing flask-session-cookie-manager\n\033[0m"
    CTF_flask-session-cookie-manager_install
    echo -e "\033[1;33m\n>> Installing Gopherus\n\033[0m"
    Pentest_Gopherus_Install
    echo -e "\033[1;33m\n>> Installing redis-rogue-server\n\033[0m"
    Pentest_redis-rogue-server_Install
    echo -e "\033[1;33m\n>> Installing redis-rogue-server-win\n\033[0m"
    Pentest_redis-rogue-server-win_Install
    echo -e "\033[1;33m\n>> Installing redis-rce\n\033[0m"
    Pentest_redis-rce_Install
    echo -e "\033[1;33m\n>> Installing redis_lua_exploit\n\033[0m"
    Pentest_redis_lua_exploit_Install
    echo -e "\033[1;33m\n>> Installing redis-ssrf\n\033[0m"
    Pentest_redis-ssrf_Install

}

# -misc

CTF_MISC_tools(){

    Rm_Lock
    echo -e "\033[1;33m\n>> Installing some misc tools\n\033[0m"
    CTF_Misc_install
    echo -e "\033[1;33m\n>> Installing common py modules\n\033[0m"
    CTF_Misc_py3_module_install
    CTF_Misc_py2_module_install
    echo -e "\033[1;33m\n>> Installing hashcat、7z2hashcat\n\033[0m"
    Pentest_hashcat_Install
    echo -e "\033[1;33m\n>> Installing stegoveritas\n\033[0m"
    CTF_stegoveritas_install
    echo -e "\033[1;33m\n>> Installing ImageMagick\n\033[0m"
    CTF_ImageMagick_install
    echo -e "\033[1;33m\n>> Installing morse2ascii\n\033[0m"
    CTF_morse2ascii_install
    echo -e "\033[1;33m\n>> Installing exiftool\n\033[0m"
    CTF_exiftool_install
    echo -e "\033[1;33m\n>> Installing steghide\n\033[0m"
    CTF_steghide_install
    echo -e "\033[1;33m\n>> Installing pdfinfo\n\033[0m"
    CTF_pdfinfo_install
    echo -e "\033[1;33m\n>> Installing zbarimg\n\033[0m"
    CTF_zbarimg_install
    echo -e "\033[1;33m\n>> Installing outguess\n\033[0m"
    CTF_outguess_install
    echo -e "\033[1;33m\n>> Installing zsteg\n\033[0m"
    CTF_zsteg_install
    echo -e "\033[1;33m\n>> Installing F5-steganography\n\033[0m"
    CTF_F5-steganography_install
    echo -e "\033[1;33m\n>> Installing LSB-Steganography\n\033[0m"
    CTF_LSB-Steganography_install
    echo -e "\033[1;33m\n>> Installing BlindWaterMark\n\033[0m"
    CTF_BlindWaterMark_install
    echo -e "\033[1;33m\n>> Installing crc32\n\033[0m"
    CTF_crc32_install
    echo -e "\033[1;33m\n>> Installing cloacked-pixel\n\033[0m"
    CTF_cloacked-pixel_install
    echo -e "\033[1;33m\n>> Installing stegosaurus\n\033[0m"
    CTF_stegosaurus_install
    Volatility_Install
    volatility3_Install

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            echo -e "\033[1;33m\n>> Installing bkcrack\n\033[0m"
            CTF_bkcrack_install
            ;;
    esac

}

# -crypto

CTF_Crypto_tools(){

    Rm_Lock
    echo -e "\033[1;33m\n>> Installing some misc tools\n\033[0m"
    CTF_Crypto_install
    echo -e "\033[1;33m\n>> Installing common py modules\n\033[0m"
    CTF_Crypto_py3_module_install
    CTF_Crypto_py2_module_install
    echo -e "\033[1;33m\n>> Installing rsatool\n\033[0m"
    CTF_rsatool_install
    echo -e "\033[1;33m\n>> Installing RsaCtfTool\n\033[0m"
    CTF_RsaCtfTool_install
    echo -e "\033[1;33m\n>> Installing CTF-RSA-tool\n\033[0m"
    CTF_CTF-RSA-tool_install
    echo -e "\033[1;33m\n>> Installing rsa-wiener-attack\n\033[0m"
    CTF_rsa-wiener-attack_install
    echo -e "\033[1;33m\n>> Installing basecrack\n\033[0m"
    CTF_basecrack_install

}

# -iot

CTF_IOT_tools(){

    Rm_Lock
    echo -e "\033[1;33m\n>> Installing some misc tools\n\033[0m"
    CTF_IOT_install
    binwalk_Install
    echo -e "\033[1;33m\n>> Installing firmware-mod-kit\n\033[0m"
    CTF_firmware_mod_kit_Install

}

# -re

CTF_RE_tools(){

    Rm_Lock
    #echo -e "\033[1;33m\n>> Installing some misc tools\n\033[0m"
    #CTF_RE_install
    echo -e "\033[1;33m\n>> Installing common py modules\n\033[0m"
    CTF_RE_py3_module_install
    #CTF_RE_py2_module_install
    echo -e "\033[1;33m\n>> Installing pyinstxtractor\n\033[0m"
    CTF_RE_pyinstxtractor_install
    echo -e "\033[1;33m\n>> Installing upx\n\033[0m"
    CTF_RE_upx_install

}

# -pwn

CTF_PWN_tools(){

    Rm_Lock
    echo -e "\033[1;33m\n>> Installing some misc tools\n\033[0m"
    CTF_PWN_install
    echo -e "\033[1;33m\n>> Installing common py modules\n\033[0m"
    CTF_PWN_py3_module_install
    CTF_PWN_py2_module_install
    echo -e "\033[1;33m\n>> Installing pwntools\n\033[0m"
    CTF_PWN_pwntools_install
    echo -e "\033[1;33m\n>> Installing pwndbg\n\033[0m"
    CTF_PWN_pwndbg_install
    echo -e "\033[1;33m\n>> Installing one_gadget\n\033[0m"
    CTF_PWN_one_gadget_install

}

# -help

Help_Info(){

    echo -e "\033[1;34mInstall by category \033[0m"
    echo -e "  \033[1;34m-web\033[0m \033[0;34m   : install WEB environment\033[0m"
    echo -e "  \033[1;34m-misc\033[0m \033[0;34m  : install MISC environment\033[0m"
    echo -e "  \033[1;34m-crypto\033[0m \033[0;34m: install Crypto environment\033[0m"
    echo -e "  \033[1;34m-iot\033[0m \033[0;34m   : install IOT environment\033[0m"
    echo -e "  \033[1;34m-re\033[0m \033[0;34m   : install Reverse environment\033[0m"
    echo -e "  \033[1;34m-pwn\033[0m \033[0;34m   : install PWN environment\033[0m"
    echo -e ""
    echo -e "\033[1;37mcreate by ffffffff0x\033[0m"
    echo -e ""

}

for cmd in $@
do
    case $cmd in
        -web)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_WEB_tools
            ;;
        -misc)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_MISC_tools
            ;;
        -crypto)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_Crypto_tools
            ;;
        -iot)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_IOT_tools
            ;;
        -re)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_RE_tools
            ;;
        -pwn)
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            JDK_Check
            CTF_PWN_tools
            ;;
        -help | help)
            printf "\033c"
            Help_Info
            exit 1
            ;;
    esac
done

echo -e "\033[1;36m \n-----OVER-----\n \033[0m"
